package com.compass.mobile.presenters

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.leanback.widget.Presenter
import com.compass.mobile.R
import com.compass.mobile.models.IndependentBillingBean

/**
 * Description： 选中的检验检查presenter
 * Date:2024/6/8 13:31
 */
class SelectedInspectPresenter : Presenter() {

    override fun onCreateViewHolder(viewGroup: ViewGroup): ViewHolder {
        val view =
            LayoutInflater.from(viewGroup.context).inflate(R.layout.item_selected_inspect, viewGroup, false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any) {
        if (item is IndependentBillingBean) {
            val vh = viewHolder as ViewHolder
            vh.tvTitle.text = item.name
            vh.tvPrice.text = "￥${item.price}元"
        }
    }

    override fun onUnbindViewHolder(viewHolder: Presenter.ViewHolder) {}
    class ViewHolder(view: View) : Presenter.ViewHolder(view) {
        var tvTitle: TextView = view.findViewById(R.id.tv_title)
        var tvPrice: TextView = view.findViewById(R.id.tvPrice)
    }
}